<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        
        // let arr2 = []
        // 这个可以拿到可枚举的值的数组
        // console.log(Object.values(arr[0])[0]);
        // console.log(arr.indexOf(0));
        // console.log(arr.find(ele=> ele == 'sb' ));
        // console.log(arr2.concat(arr));
        
        
        let arr = [{ a: ['nick', 'dick'] }, { b: ['sb', "bs"] }]

        // 第一种
        function getTarge(arr, targe) {
            var allValue = []
            arr.forEach(element => {
                // console.log(Object.values(element)[0]);
                allValue.push(Object.values(element)[0])
                // allValue = allValue.concat(...Object.values(element)[0])  //这里为什么打印是个空数组
           
            });
            console.log('allValue', allValue);
            var allValue2 = []
            allValue.forEach(ele=>{
               ele.forEach(ele=>{
                   allValue2.push(ele)
               })
            })
            // console.log(allValue2);
            if(allValue2.find(ele => ele ==targe))
            return 'found'
            else
            return 'nofound'
        }

        // 第二种
        function getTarge2 (arr , targe){
            var allValue  = []
            arr.forEach(ele=>{
                allValue = allValue.concat(Object.values(ele)[0])
            })
            // console.log(allValue);
            if(allValue.indexOf(targe)!==-1) console.log('found');
            else console.log('not found');
        }

       console.log( getTarge(arr, 'nick2'));
       getTarge2(arr,'nick')
     
    


   

    </script>
</body>

</html>